import { ResponseData } from "../../common";

export const jsonFormat = <T>(data: T, error: any = null) : ResponseData<T> => {
    let code: 0 | 1 = error ? 1 : 0;
    let message: string = error ? (error.message || error) : '';
    return { code, data, message };
}